import request from '@/config/axios'

// 通话录音 VO
export interface RecordVO {
  id: number // 编号
  caller: string // 主叫
  callee: string // 被叫
  startTime: Date // 应答时间
  endTime: Date // 挂断时间
  callSecond: number // 呼叫时长
  callMinute: number // 计费分钟
  recordUrl: string // 本地录音地址
  tempRecordUrl: string // 临时录音地址
  downloadStatus: boolean // 录音下载状态
  channelId: number // 渠道ID
  reqNo: string // 请求编号
  userData: string // 用户数据
  source: string // 场景来源
  sourceId: string // 来源编号
  ownerUserId: number // 负责人
}

// 通话录音 API
export const RecordApi = {
  // 查询通话录音分页
  getRecordPage: async (params: any) => {
    return await request.get({ url: `/call/record/page`, params })
  },
  // 查询ivr通话记录分页
  getIvrRecordPage: async (params: any) => {
    return await request.get({ url: `/call/record/page-by-ivr`, params })
  },
  // ivr对话详情
  acsNlpResult: async (params) => {
    return await request.get({ url: `/call/acs-nlp-result/simple-list`, params })
  },
  // 查询通话录音详情
  getRecord: async (id: number) => {
    return await request.get({ url: `/call/record/get?id=` + id })
  },
  // 新增通话录音
  createRecord: async (data: RecordVO) => {
    return await request.post({ url: `/call/record/create`, data })
  },

  // 修改通话录音
  updateRecord: async (data: RecordVO) => {
    return await request.put({ url: `/call/record/update`, data })
  },

  // 删除通话录音
  deleteRecord: async (id: number) => {
    return await request.delete({ url: `/call/record/delete?id=` + id })
  },

  // 导出通话录音 Excel
  exportRecord: async (params) => {
    return await request.download({ url: `/call/record/export-excel`, params })
  },
  // 新的查询通话录音分页
  getRecordPageBy: async (params: any) => {
    return await request.get({ url: `/call/record/page-by-workbench`, params })
  },
  // 获得群呼任务呼叫名单分页
  getTaskCalleePage: async (params) => {
    return await request.get({ url: `/call/task-callee-list/page`, params })
  },

  // 创建群呼任务呼叫名单
  createTaskCallee: async (formData) => {
    return await request.upload({ url: `/call/task-callee-list/create`, data: formData })
  },
  // 查看群呼任务呼叫名单
  getTaskCalleeId: async (id) => {
    return await request.get({ url: `/call/task-callee-list/get?id=` + id })
  },
  // 更改群呼任务呼叫名单
  updateTaskCallee: async (data) => {
    return await request.put({ url: `/call/task-callee-list/update`, data })
  },
  // 获取呼叫名单模板
  getTemplate: async () => {
    return await request.download({ url: `/call/task-callee-list-number/get-import-template` })
  },
  // 获取导入工作台的模板
  getCallTemplate: async () => {
    return await request.download({ url: '/call/user-callee-list/get-import-template' })
  },
  // 删除呼叫名单
  deleteTaskCalle: async (id) => {
    return await request.delete({ url: `/call/task-callee-list/delete?id=` + id })
  },
  // 追加
  appendTaskCallee: async (formData) => {
    return await request.upload({ url: `/call/task-callee-list/append`, data: formData })
  },
  // 获得群呼任务呼叫名单号码列分页
  getTaskCalleelistPage: async (params) => {
    return await request.get({ url: `/call/task-callee-list-number/page`, params })
  },
  // 删除群呼任务呼叫名单号码列
  deleteTaskCallelist: async (id) => {
    return await request.delete({ url: `/call/task-callee-list-number/delete?id=` + id })
  },
  //线索和客户查看摘要
  getSummary: async (id: number) => {
    return await request.get({ url: `/call/record/get-summary?id=` + id })
  },
  //获取呼叫名单列表详情
  taskCalleeListNumberRule: async (params) => {
    return await request.get({ url: `/call/task-callee-list-number-rule/simple-list`, params })
  }
}
